<?php

namespace PAT\CartBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * PAT\CartBundle\Entity\Command
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="PAT\CartBundle\Entity\CommandRepository")
 */
class Command
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @var \DateTime $paymentDate
     *
     * @ORM\Column(name="paymentDate", type="date")
     */
    protected $paymentDate;

    /**
     * @var integer $totalPrice
     *
     * @ORM\Column(name="totalPrice", type="integer")
     * @ORM\JoinColumn(nullable=true)
     */
    protected $totalPrice;
    
    /**
     * @var integer $paymentMode
     *
     * @ORM\Column(name="paymentMode", type="smallint")
     */
    protected $paymentMode;
	
	/**
	 * @ORM\ManyToOne(targetEntity="PAT\UserBundle\Entity\User", inversedBy="commands")
        * @ORM\JoinColumn(nullable=false)
        */
	 protected $user;
	 
	 /**
	  * @ORM\ManyToOne(targetEntity="PAT\UserBundle\Entity\Address")
      * @ORM\JoinColumn(nullable=false)
      */
	 protected $addressDelivery;
	 
	 /**
	  * @ORM\ManyToOne(targetEntity="PAT\UserBundle\Entity\Address")
      * @ORM\JoinColumn(nullable=false)
      */
	 protected $addressPayment;
	 

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set paymentDate
     *
     * @param \DateTime $paymentDate
     * @return Command
     */
    public function setPaymentDate($paymentDate)
    {
        $this->paymentDate = $paymentDate;
    
        return $this;
    }

    /**
     * Get paymentDate
     *
     * @return \DateTime 
     */
    public function getPaymentDate()
    {
        return $this->paymentDate;
    }

    /**
     * Set totalPrice
     *
     * @param integer $totalPrice
     * @return Command
     */
    public function setTotalPrice($totalPrice)
    {
        $this->totalPrice = $totalPrice;
    
        return $this;
    }

    /**
     * Get totalPrice
     *
     * @return integer 
     */
    public function getTotalPrice()
    {
        return $this->totalPrice;
    }
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->products = new \Doctrine\Common\Collections\ArrayCollection();
    }
    
    /**
     * Set user
     *
     * @param PAT\UserBundle\Entity\User $user
     * @return Command
     */
    public function setUser(\PAT\UserBundle\Entity\User $user)
    {
        $this->user = $user;
    
        return $this;
    }

    /**
     * Get user
     *
     * @return PAT\UserBundle\Entity\User 
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * Set addressDelivery
     *
     * @param PAT\UserBundle\Entity\Address $addressDelivery
     * @return Command
     */
    public function setAddressDelivery(\PAT\UserBundle\Entity\Address $addressDelivery)
    {
        $this->addressDelivery = $addressDelivery;
    
        return $this;
    }

    /**
     * Get addressDelivery
     *
     * @return PAT\UserBundle\Entity\Address 
     */
    public function getAddressDelivery()
    {
        return $this->addressDelivery;
    }

    /**
     * Set addressPayment
     *
     * @param PAT\UserBundle\Entity\Address $addressPayment
     * @return Command
     */
    public function setAddressPayment(\PAT\UserBundle\Entity\Address $addressPayment)
    {
        $this->addressPayment = $addressPayment;
    
        return $this;
    }

    /**
     * Get addressPayment
     *
     * @return PAT\UserBundle\Entity\Address 
     */
    public function getAddressPayment()
    {
        return $this->addressPayment;
    }

    /**
     * Add products
     *
     * @param PAT\CartBundle\Entity\Product $products
     * @return Command
     */
    public function addProduct(\PAT\ProductBundle\Entity\Product $products)
    {
        $this->products[] = $products;
    
        return $this;
    }

    /**
     * Remove products
     *
     * @param PAT\CartBundle\Entity\Product $products
     */
    public function removeProduct(\PAT\CartBundle\Entity\Product $products)
    {
        $this->products->removeElement($products);
    }

    /**
     * Get products
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getProducts()
    {
        return $this->products;
    }

    /**
     * Set paymentMode
     *
     * @param integer $paymentMode
     * @return Command
     */
    public function setPaymentMode($paymentMode)
    {
        $this->paymentMode = $paymentMode;
    
        return $this;
    }

    /**
     * Get paymentMode
     *
     * @return integer 
     */
    public function getPaymentMode()
    {
        return $this->paymentMode;
    }
}